﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharedLib.MessageFramework
{
    public partial class MessageDispatcher
    {
        /// <summary>
        /// Controls the thread amount of Handler types
        /// </summary>
        public class HandlerMonitor
        {
            string _handlerUID;

            public string HandlerUID
            {
                get { return _handlerUID; }
            }

            int _maxCapacity;

            public int MaxCapacity
            {
                get { return _maxCapacity; }
                set { _maxCapacity = value; }
            }

            int _currentUsage = 0;

            public int CurrentUsage
            {
                get { return _currentUsage; }
                set { _currentUsage = value; }
            }

            public HandlerMonitor(string handlerUID, int maxCapacity, int currentUsage)
            {
                _handlerUID = handlerUID;
                _maxCapacity = maxCapacity;
                _currentUsage = currentUsage;
            }

            public bool HasCapacity()
            {
                return (MaxCapacity > CurrentUsage);
            }
        }
    }
}